import requests
import pytest,allure

@allure.feature("用户分组")
class TestCRMEB:
    project_url = "http://47.97.110.120:8899"
    @pytest.fixture(scope='function',autouse=True)
    def login(self): # json 换成data就是form表单传参
        response = requests.post(url=self.project_url + "/adminapi/login",
                                 json={"account": "admin", "pwd": "123456", "key": "6618e4403150d",
                                       "captchaType": "blockPuzzle"})
        self.token = response.json()['data']['token']
        msg = response.json()['msg']

    def test_search_group(self): # 侯雯中 其实就是crmeb的token了
        response1 = requests.get(url=self.project_url + "/adminapi/user/user_group/list?=1&limit=15",
                     headers={"Authori-zation": "Bearer " + str(self.token)})
        assert response1.status_code == 200
        id_list = [] # 提取全部的id
        for i in response1.json()['data']['list']:
            id_list.append(i['id'])
        print(id_list)



